package com.gdwstudy.array_;

import java.util.Arrays;
import java.util.Comparator;

/**
 * @author 关道伟
 * @version 1.0
 */
public class ArrayMethod {
    public static void main(String[] args) {
        Integer[] arr={23,12,9,-1,10};
        System.out.println(Arrays.toString(arr));
        Arrays.sort(arr);
        System.out.println("排序后");
        System.out.println(Arrays.toString(arr));
        System.out.println("自由排序");
        Arrays.sort(arr,new Comparator() {


            @Override
            public int compare(Object o1,Object o2) {
                Integer o11 = (Integer) o1;
                Integer o21 = (Integer) o2;
                return o21-o11;
            }
        });
        System.out.println("自由排序后");
        System.out.println(Arrays.toString(arr));
    }
}
